// import { useRouter } from "next/router";
import React from 'react'
import Pc from './pc/index'
import M from './m/index'


export default class extends React.Component {
  // 获取用户设备信息 判断移动端和PC端
  static async getInitialProps({ req }) {
    const userAgent = req.headers['user-agent'].match(
      /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
    );
    if (userAgent) {
      return { userAgent: false };
    }
    return { userAgent: true }
  }

  // const router = useRouter();
  // router.push('/pc');

  render() {
    return (
      <>
        {this.props.userAgent ? <Pc /> : <M />}
      </>
    )
  }
}
